package com.itheima.health.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.health.mapper.MemberMapper;
import com.itheima.health.pojo.Member;
import com.itheima.health.service.MemberService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {
    @Override
    //根据电话号码查询用户
    public Member findByPhone(String phone) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("PHONENUMBER",phone);
        Member member = baseMapper.selectOne(queryWrapper);
        return member;
    }

    @Override                                  //日期    用户id   套餐id
    public int isOrderDayByMemberIdBySetmealId(String orderDate, Integer id, Integer tid) {
        int orderDayByMemberIdBySetmealId = baseMapper.isOrderDayByMemberIdBySetmealId(orderDate, id, tid);
        return orderDayByMemberIdBySetmealId;
    }
}
